<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>css3</title>
  <style>
    .box {
      width: 500px;
      height: 500px;
      background: red url('2.jpg') no-repeat;
      border: 10px dashed green;
      padding: 20px;
      /* background-origin: border-box; */
      background-origin: content-box;
    }
  </style>
</head>

<body>
  <div class="box"></div>
</body>

</html>